package com.guodi.map.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
* 数据源 实体类
* @author 陈宏成
* @date 2022-01-18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("map_database_source")
@ApiModel(value="MapDatabaseSource对象", description="数据源")
public class MapDatabaseSource implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "（新增不用填）主键id", required = false)
    @Length(max = 32, message = "主键id最大为32个字符")
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @ApiModelProperty(value = "数据库类型，字典值",required = true)
    @Length(max = 30, message = "数据库类型，字典值最大为30个字符")
    @NotBlank(message = "数据库类型 不能为空")
    @TableField(value = "type")
    private String type;

    @ApiModelProperty(value = "ip地址",required = true)
    @Length(max = 30, message = "ip地址最大为30个字符")
    @NotBlank(message = "ip地址 不能为空")
    @TableField(value = "ip")
    private String ip;

    @ApiModelProperty(value = "端口",required = true)
    @Length(max = 6, message = "端口最大为6个字符")
    @NotBlank(message = "端口 不能为空")
    @TableField(value = "port")
    private String port;

    @ApiModelProperty(value = "数据库实例/数据库名",required = true)
    @Length(max = 30, message = "数据库实例/数据库名最大为30个字符")
    @NotBlank(message = "数据库实例 不能为空")
    @TableField(value = "instance")
    private String instance;

    @ApiModelProperty(value = "用户名",required = true)
    @Length(max = 30, message = "用户名最大为30个字符")
    @NotBlank(message = "用户名 不能为空")
    @TableField(value = "username")
    private String username;

    @ApiModelProperty(value = "密码",required = true)
    @Length(max = 50, message = "密码最大为50个字符")
    @NotBlank(message = "密码 不能为空")
    @TableField(value = "password")
    private String password;

    @ApiModelProperty(value = "创建人", hidden = true)
    @Length(max = 32, message = "创建人最大为32个字符")
    @TableField(value = "creator", updateStrategy = FieldStrategy.NEVER)
    private String creator;

    @ApiModelProperty(value = "创建时间", hidden = true)
    @TableField(value = "create_time", updateStrategy = FieldStrategy.NEVER)
    private Date createTime;

    @ApiModelProperty(value = "修改人", hidden = true)
    @Length(max = 32, message = "修改人最大为32个字符")
    @TableField(value = "modifier", insertStrategy = FieldStrategy.NEVER)
    private String modifier;

    @ApiModelProperty(value = "修改时间", hidden = true)
    @TableField(value = "modify_time", insertStrategy = FieldStrategy.NEVER)
    private Date modifyTime;

    @ApiModelProperty(value = "备注")
    @Length(max = 500, message = "备注最大为500个字符")
    @TableField(value = "remark", updateStrategy = FieldStrategy.DEFAULT)
    private String remark;

    @ApiModelProperty(value = "数据源名称",required = true)
    @Length(max = 255, message = "数据源名称最大为255个字符")
    @NotBlank(message = "数据源名称 不能为空")
    @TableField(value = "source_name")
    private String sourceName;

    @ApiModelProperty(value = "数据库版本名，oracle会用到")
    @Length(max = 50, message = "数据库版本名最大为50个字符")
    @TableField(value = "db_ver_num")
    private String dbVerNum;

    @ApiModelProperty(value = "soe接口的featureDatasetName参数")
    @TableField(exist = false)
    private String featureDatasetName;

    @ApiModelProperty("soe参数")
    @TableField(exist = false)
    private  String system;
}
